package org.wang.generalcode.modules.sys.converter;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.wang.generalcode.modules.sys.pojo.entity.Role;
import org.wang.generalcode.modules.sys.pojo.model.Option;
import org.wang.generalcode.modules.sys.pojo.params.RoleParams;

import java.util.List;

/**
 * 角色对象转换器
 *
 * @author wangchong
 * @since 2022/5/29
 */
@Mapper(componentModel = "spring")
public interface RoleConverter {

//    Page<RolePageVO> convertToPageVo(Page<Role> page);

    @Mappings({
            @Mapping(target = "value", source = "id"),
            @Mapping(target = "label", source = "name")
    })
    Option<Long> entity2Option(Role role);

    List<Option<Long>> entities2Options(List<Role> roles);

    Role toEntity(RoleParams roleParams);

//    RoleForm toForm(SysRole entity);
}